package com.lc.luzhengtang.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;

import com.lc.luzhengtang.R;
import com.lc.luzhengtang.base.BaseActivity;
import com.lc.luzhengtang.fragment.ISlideCallback;
import com.lc.luzhengtang.fragment.ListFragment;
import com.lc.luzhengtang.weigh.SlideDetailsLayout;

import java.util.ArrayList;

import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/5/3.
 */
public class ShopDetailActivity2 extends BaseActivity implements ISlideCallback, View.OnClickListener {

    private SlideDetailsLayout mSlideDetailsLayout;


    private String shop_id;
    private ArrayList<Fragment> mFragments = new ArrayList<>();
    ListFragment listFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shopdetail2);
        ButterKnife.bind(this);

        mSlideDetailsLayout = (SlideDetailsLayout) findViewById(R.id.slidedetails);
        shop_id = getIntent().getStringExtra("goods_id");

        listFragment = new ListFragment();
        //Activity传值，通过Bundle
        Bundle bundle = new Bundle();
        bundle.putString("shop_id", shop_id);
        //首先有一个Fragment对象 调用这个对象的setArguments(bundle)传递数据
        listFragment.setArguments(bundle);
        FragmentManager fm = getSupportFragmentManager();
        fm.beginTransaction().replace(R.id.slidedetails_front, listFragment).commit();
    }


    @Override
    public void onClick(View v) {

    }


    @Override
    public void openDetails(boolean smooth) {
        mSlideDetailsLayout.smoothOpen(smooth);
    }

    @Override
    public void closeDetails(boolean smooth) {
        mSlideDetailsLayout.smoothClose(smooth);
    }
}
